<?php
session_start();

// Database connection variables

$dbServer = "acuario.ecci.ucr.ac.cr";
$dbDatabase = "bdusj2";
$dbUser = "us2";
$dbPass = "usj2";

$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
    or die("Couldn't connect to database server");

$dConn = mysql_select_db($dbDatabase, $sConn)
    or die("Couldn't connect to database $dbDatabase");

//Consulta para desplegar los de los evaluadores
$dbQuery = "SELECT * ";
$dbQuery .= "FROM Usuario ";
$dbQuery .= "WHERE TipoUsuario = '3' ";
$dbQuery .= "ORDER BY Apellido1 ASC";
$result = mysql_query($dbQuery) or die("Couldn't get file list");


//Consulta para jalar todas las fotos de la base
//Consulta para desplegar la foto
$dbQuery = "SELECT TipoFoto, Foto, IDUsuario ";
$dbQuery .= "FROM Foto ";
//$dbQuery .= "WHERE IDUsuario = $identificacion";
$resultado = mysql_query($dbQuery) or die("Couldn't get file list");



//We start of by connecting to our database and using a select query to get the id, title and type of each file in our database. Notice how I haven't used "SELECT *" in the select query? If I did, then MySQL would return the datosPlantilla field for each record as well, which would make our query extremely slow and inefficient because we don't actually need that field for our script.

?>

<h2>Lista de evaluadores del sistema:</h2>
<img src="image/evaluar.jpg" alt="Evaluadores" width="150" height="200">
<!--<img border="0" src="http://acuario.ecci.ucr.ac.cr/SISADPRO_malincy/image/subir_archivo.jpg">-->

<table border="1" cellpadding="0" cellspacing="0" <bordercolor="#111111" width="100%">
        <tr>
            <td width="15%" bgcolor="#0174DF" height="35">
                <p style="margin-left: 10"><b><font size="2" face="Verdana" color="#FFFFFF">
                            Login</font></b></td>
            <td width="15%" bgcolor="#0174DF" height="35">
                <p style="margin-left: 10"><b><font size="2" face="Verdana" color="#FFFFFF">
                            Nombre</font></b></td>
            <td width="15%" bgcolor="#0174DF" height="35">
                <p style="margin-left: 10"><b><font size="2" face="Verdana" color="#FFFFFF">
                            Primer Apellido</font></b></td>
            <td width="5%" bgcolor="#0174DF" height="35">
                <p style="margin-left: 10"><b><font size="2" face="Verdana" color="#FFFFFF">
                            Segundo Apellido</font></b></td>
            <td width="15%" bgcolor="#0174DF" height="35">
                <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
                            IDUA</font></b></td>
            <td width="10%" bgcolor="#0174DF" height="35">
                <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
                            Actualizar</font></b></td>
            <td width="10%" bgcolor="#0174DF" height="35">
                <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
                            Ver Fotografia</font></b></td>
            <!--
            <td width="10%" bgcolor="#0174DF" height="35">

            <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">

            Archivo</font></b></td>


            <td width="10%" bgcolor="#0174DF" height="35">

            <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">

            Archivo</font></b></td>

            -->

        </tr>

        <?php

        //As mentioned above, we will be displaying each file as a table row. The HTML code above creates this table.
        $row2=  mysql_fetch_array($resultado);
        while($row = mysql_fetch_array($result)) {

            ?>

        <tr>

            <td width="15%" bgcolor="#A9D0F5" height="35">

                <p style="margin-left: 10; margin-right: 10">

                    <font face="Verdana" size="2">

                            <?php echo $row["Login"]; ?>

                    </font>

            </td>

            <td width="15%" bgcolor="#A9D0F5" height="35">

                <p style="margin-left: 10; margin-right: 10">

                    <font face="Verdana" size="2">

                            <?php echo $row["Nombre"]; ?>

                    </font>

            </td>


            <td width="15%" bgcolor="#A9D0F5" height="35">

                <p style="margin-left: 10; margin-right: 10">

                    <font face="Verdana" size="2">

                            <?php echo $row["Apellido1"]; ?>

                    </font>

            </td>

            <td width="5%" bgcolor="#A9D0F5" height="35">

                <p style="margin-left: 10; margin-right: 10">

                    <font face="Verdana" size="2">

                            <?php echo $row["Apellido2"]; ?>

                    </font>

            </td>



            <td width="25" bgcolor="#A9D0F5" height="35">

                <p style="margin-left: 10">

                    <font face="Verdana" size="2">

                            <?php echo $row["IDUA"]; ?>

                    </font>

            </td>


            <td width="10%" bgcolor="#A9D0F5" height="35">

                <p style="margin-left: 10"><font face="Verdana" size="2">

                        <a href="DatosEvaluador.php?fileId=<?php echo $row["IDUsuario"]; ?>">

                            Ver Datos
							<!--<img src='image/datos.jpg' width='100' height='30' border='0' alt='Descargar' align="center">-->

                        </a></font>

            </td>

            <td width="10%" bgcolor="#A9D0F5" height="35">

                <p style="margin-left: 10"><font face="Verdana" size="2">

                        <a href="Descargar_foto.php?fileId=<?php echo $row["IDUsuario"]; ?>">
                            Ver Fotografia
                                <?php

                                //Ingresamos el usuario
                                $identificacion= $row["IDUsuario"];

                                if($row["IDUsuario"] == $row2["IDUsuario"]) {
                                    $foto = $row2["Foto"];
                                //echo "<b>llegue:</b> $nombre <br>";

                                //echo "<img src='$row2['Foto']' border='0' width='300' height='100'>";
                                }





                                //$vars = get_defined_vars();
                                //print_r($vars);

                                //}


                                //echo $fileContent;
                                //echo $roww["Foto"];
                                //echo $resultado["Foto"];
                                //echo $foto;



/*
else
{
echo "Record doesn't exist.";
}
*/
                                ?>

<!--<img src="<?php //echo $foto; ?>"-->


                            <!--No intercambiar-->

                        </a></font>

            </td>
            <!--
            <td width="10%" bgcolor="#A9D0F5" height="35">

            <p style="margin-left: 10"><font face="Verdana" size="2">

            <a href="Descargar_archivo.php?fileId=<?php echo $row["IDUsuario"]; ?>">

            Descargar ahora

            </a></font>

            </td>


            <td width="10%" bgcolor="#A9D0F5" height="35">

            <p style="margin-left: 10"><font face="Verdana" size="2">

            <a href="cargarDatos.php?fileId=<?php echo $row["IDUsuario"]; ?>">

            Eliminar

            </a></font>

            </td>
            -->
        </tr>



        <?php

        }

        echo "</table>";

        ?>

